<template>
  <page-meta :root-font-size="$rootFontSize"></page-meta>
  <view>
    <!--账户与安全-->
    <view class="mx-4">
      <u-cell-group :border="false">
        <u-cell
          title="修改密码"
          titleStyle="margin-left:-24rpx;"
          :isLink="true"
          rightIconStyle="fontSize:34rpx; color:#cccccc; margin-right:-28rpx;"
          size="large"
          @click="goTo('revise-password')"
        >
        </u-cell>
        <u-cell
          title="登录设备"
          titleStyle="margin-left:-24rpx;"
          :isLink="true"
          rightIconStyle="fontSize:34rpx; color:#cccccc; margin-right:-28rpx;"
          size="large"
          @click="goTo('device-manage')"
        >
        </u-cell>
        <u-cell
          title="绑定淘宝账号"
          titleStyle="margin-left:-24rpx;"
          :isLink="true"
          rightIconStyle="fontSize:34rpx; color:#cccccc; margin-right:-28rpx;shoppingAccountInfo"
          size="large"
          :value="accountInfo.taobaoAccountStatusStr"
          @click="goBind(1)"
        >
        </u-cell>
        <u-cell
          title="绑定抖音账号"
          titleStyle="margin-left:-24rpx;"
          :isLink="true"
          rightIconStyle="fontSize:34rpx; color:#cccccc; margin-right:-28rpx;shoppingAccountInfo"
          size="large"
          :value="accountInfo.tiktokAccountStatusStr"
          @click="goBind(2)"
        >
        </u-cell>
      </u-cell-group>
    </view>
  </view>
</template>

<script>
import { shoppingAccountStatus } from '../../services/mine';

export default {
  data() {
    return {
      isShow: false,
      accountInfo: {
        taobaoAccountStatus: '0',
        taobaoAccountStatusStr: '未绑定',
        tiktokAccountStatus: '0',
        tiktokAccountStatusStr: '未绑定',
      },
    };
  },
  async onShow() {
    this.getShoppingAccountStatus();
  },
  methods: {
    //路由跳转
    goTo(url) {
      this.$Router.push({
        name: url,
      });
    },
    //绑定淘宝&抖音账号
    async goBind(type) {
      this.$Router.push({
        name: 'account-bind',
        params: {
          mediaType: type,
        },
      });
    },
    //获取绑定账号状态
    async getShoppingAccountStatus() {
      const { code, data } = await shoppingAccountStatus();
      if (code != 200) return;
      this.accountInfo = data;
    },
  },
};
</script>

<style></style>
